﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Linq;
using System.Reflection;
using System.Runtime.InteropServices;
using System.Threading;
using System.Threading.Tasks;
using System.Windows.Forms;
using TransManage;
using ZK.Common;
using ZK.YHP_TransManage.Test;

namespace ZK.YHP_TransManage
{
    static class Program
    {

        [DllImport("kernel32.dll")]
        public static extern Boolean AllocConsole();
        [DllImport("kernel32.dll")]
        public static extern Boolean FreeConsole();

        /// <summary>
        /// 应用程序的主入口点。
        /// </summary>
        [STAThread]
        static void Main()
        {
            //
            AllocConsole();
            Common.ShowBlackBox.WriteLine("2 程序已经启动");


            //判断是否已经有需要运行一个实例，如果系统没有，则运行一个
            bool noRun;
            using (System.Threading.Mutex m = new System.Threading.Mutex(true, Application.ProductName, out noRun))
            {
                ///123
               // if (noRun)
                {
                    Application.EnableVisualStyles();
                    Application.SetCompatibleTextRenderingDefault(false);
                    //程序启动后先读取配置文件
                    {
                        Myconfig.ReadMyconfigM();
                    }


                    //if (Common.AppConfigHelper.GetAppSettings("Debug") == "false")
                    //{
                    //    Application.Run(new Index());//主要入口
                    //}
                    //else
                    //{
                    //    //Application.Run(new @lock());//主要入口
                    //    Application.Run(new Index());//主要入口
                    //}
                    //Application.Run(new 地磅串口转tcp());
                    //Application.Run(new VLCRTSPTest());
                    Application.Run(new 文字转语音());
                    //ShiWaiDuKaQi
                    //Application.Run(new TestIndex());
                    //Application.Run(new Test.接口测试());
                    //Application.Run(new Test.ShiWaiDuKaQi());
                    //Application.Run(new Test.OnbonLed());
                    //Application.Run(new UserControlLibrary.HardWare());
                    //Application.Run(new Test.LogTest());
                    //Application.Run(new Index());
                    ///Application.Run(new UserControlLibrary.Print(new Common.ProModels.TruckYxInfo())) ;
                    // Application.Run(new Test.testwinform());
                    //  Application.Run(new Test.Camera());//确认32位dll可以执行。
                }
                //else
                //{
                //    MessageBox.Show("目前已有一个程序在运行，请勿重复运行程序", "提示");
                //}
            }




            Common.ShowBlackBox.WriteLine("2：2秒后关闭...");
            Thread.Sleep(2000);
            FreeConsole();
        }





    }
}
